﻿@using PagedList
@model IPagedList<LibrarySystem.Models.BookModel>
@{
    ViewBag.Title = "Trang chủ";
    Layout = "~/Views/Shared/_User_Layout.cshtml";
}

<h3>Sách Trong Thư Viện</h3>
<div align="center">
    Trang @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
    của @Model.PageCount
     
    @if (Model.HasPreviousPage)
    {
        @Html.ActionLink("<< Về Đầu", "Index", new { page = 1, sort = ViewBag.CurrentSort })
        @Html.Raw(" | ")
        @Html.ActionLink("< Trước", "Index", new { page = Model.PageNumber - 1, sort = ViewBag.CurrentSort  })
    }
    else
    {
        @:<< Về Đầu
        @Html.Raw(" | ");
        @:< Trước
    }
    @Html.Raw(" | ")
    @if (Model.HasNextPage)
    {
        @Html.ActionLink("Sau >", "Index", new { page = Model.PageNumber + 1, sort = ViewBag.CurrentSort})
        @Html.Raw(" | ");
        @Html.ActionLink("Về Cuối >>", "Index", new { page = Model.PageCount, sort = ViewBag.CurrentSort })
    }
    else
    {
        @:Sau >
        @Html.Raw(" | ")
        @:Về Cuối >>
    }
</div>
<br />
@foreach (var item in Model)
{
    <div class="thumbs">
        <a href="@Url.Action("ThongTinSach", "Home")/@item.BookCode"><img src="images/@item.Photo" width="160" /></a><br />
        <div align="center">
        @Html.ActionLink(@item.BookName, "ThongTinSach", new { id = item.BookCode}) <br />
        </div>
    </div>
}

@section _RightSection 
{
    @Html.Partial("_CategoryMenu")
    @Html.Partial("_MostBorrowedTimes")
}
